
#pragma  once
#include <string>
#include <iostream>
#include <cstdio>
#include <time.h>

#define INFO    1
#define WARNING 2
#define ERROR   3
#define FATAL   4

#define LOG(level,message) log(#level,message,__FILE__,__LINE__)


void log(std::string level,std::string message,std::string fname,int eline){
        struct tm t;
        time_t now = time(NULL);
        localtime_r(&now,&t);

        printf("[%-7s][%-4d-%02d-%02d %02d:%02d:%02d][%-30s][%-15s][%-4d]\n",\
                level.c_str(),t.tm_year+1900,t.tm_mon+1,t.tm_mday,t.tm_hour,t.tm_min,t.tm_sec,\
                message.c_str(),fname.c_str(),eline);
    }
